{include file="./headStart.tpl"}                                                                                                                                                                           
<script type="text/javascript">  
$(document).ready(function() {
  $("#companyName").focus();
  subCategoryCombo();
  
  //code for form validation
  $("#frmSupplier").validate({
	rules: {
		contactPerson1: { required: true, minlength: 2 },
		mobile1: { required: true, minlength: 10, maxlength: 11 },
		address: { required: true, minlength: 2 }
	},
	messages: {
		contactPerson1: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>",
		mobile1: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>",
		address: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>"
	},
	success:function(label){
		label.html("<img src='./images/right.jpg' height='10' width='10' alt='Valid'>");
	},
  });
});                                                                                                                                                                           
function deletechecked()                                                                                                                                                                                   
{                                                                                                                                                                                                          
	var answer = confirm("Delete Selected Recored ?")                                                                                                                                                        
	if (answer)                                                                                                                                                                                              
	{                                                                                                                                                                                                        
	  document.messages.submit();                                                                                                                                                                            
	}                                                                                                                                                                                                        
	return false;                                                                                                                                                                                            
}                                    

function subCategoryCombo()
{
  var dataString = "categoryId=" + $('#categoryId').val();
    	$.ajax({
    		url: "./subCategoryAjSupp.php",
    		cache: false,
    		data: dataString,
    		success:function(data){
    			$('#subCategoryComboSpan').html(data);
    			$('#categoryId').focus();
        }
      });
}                                                                                                                                                                     
</script>
{include file="./headEnd.tpl"}               
<form action="{$smarty.server.PHP_SELF}" method="post" name="frmSupplier" id="frmSupplier">                                                                                                                              
<input type="hidden" name="supplierId" value="{$supplierId}" />                                                                                                                                                  
<input type="hidden" name="redirectFrom" value="{$redirectFrom}" />                                                                                                                                                  
<table align="center" border="1" cellpadding="2" cellspacing="1" >                                                                                                                                         
<tr>                                                                                                                                                                                                       
  <td align="center" class="table1" colspan="4">Supplier Entry</td>
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">Company Name :</td>                                                                                                                                                                        
  <td class="table2" colspan="3"><input type="text" name="companyName" id="companyName" value="{$companyName}" size="93"></td>                                                                                                                        
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">Contact Person 1<font color="red"> *</font> :</td>                                                                                                                                                                       
  <td class="table2"><input type="text" name="contactPerson1" id="contactPerson1" value="{$contactPerson1}"  size="50"></td>   
  <td align="left" class="table2">Mobile 1<font color="red"> *</font> :</td>                                                                                                                                                                          
  <td class="table2"><input  type="text" name="mobile1"  id="mobile1" value="{$mobile1}"></td>                                                                                                                                    
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">Contact Person 2 :</td>                                                                                                                                                                         
  <td class="table2"><input type="text" name="contactPerson2" value="{$contactPerson2}" size="50"></td> 
  <td align="left" class="table2">Mobile 2 :</td>                                                                                                                                                                          
  <td class="table2"><input type="text" name="mobile2" value="{$mobile2}"></td>                                                                                                                                         
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">Landline No<font color="red"> *</font> :</td>                                                                                                                                                                         
  <td class="table2"><input type="text" name="code" value="{$code}" size="15"><input type="text" name="phoneNo" value="{$phoneNo}" size="30"></td>                                                                                                                                         
</tr>
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">Address<font color="red"> *</font> :</td>                                                                                                                                                                           
  <td class="table2" colspan="3"><textarea name="address" id="address" rows="5" cols="80">{$address}</textarea></td>                                                                                                                               
</tr>                                                                                                                                                                                                                                                                                                                                                                                                           
<tr>                                                                                                                                                                                                       
  <td align="left" class="table2">City :</td>                                                                                                                                                                              
  <td class="table2"><input type="text" name="city" value="{$city}" size="50"></td>                                                                                                                                                 
  <td align="left" class="table2">Email :</td>                                                                                                                                                                             
  <td class="table2"><input type="text" name="email" value="{$email}" size="40"></td>  
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                              
  <td align="left" class="table2">Web :</td>
  <td class="table2"><input type="text" name="web" value="{$web}" size="50"></td>
  <td align="left" class="table2">TIN No. :</td>
  <td class="table2"><input type="text" name="partyTINNo" value="{$partyTINNo}" size="40"></td>
</tr>
<tr>                                                                                                                                              
  <td align="left" class="table2">Product Category :</td>
  <td class="table2">
    <select name="categoryId" id="categoryId" class="categoryId" onchange="subCategoryCombo();">
    	<option value="0">Select Category</option>     
      {html_options values=$categoryIdArr output=$categoryNameArr selected="{$categorySelected}"}
    </select></td>
  <td align="left" class="table2">Sub-Category :</td>
  <td class="table2"><span id="subCategoryComboSpan"></span></td>
</tr>  
<tr>     
  <td class="table2">&nbsp</td>                                                                                                                                                                                                
  <td class="table2" align="right"><input class="button" type="submit" name="insertBtn" value="Submit" class="insertBtn" />
  </td>
  <td class="table2" >
  {if $supplierId > 0}
  <input class="button" type="submit" name="cancelBtn" value="Cancel" />
  {else}
  &nbsp
  {/if}
  </td>
</tr>                                                                                                                                                                                                    
</table>                                                                                                                                                                                                   
</form>                                                                                                                                                                                                    
                                                                                                                                                                                                           
<form action="{$smarty.server.PHP_SELF}" name='supplier' method='POST'>                                                                                                                                       
<table border='0' cellpadding='1' cellspacing='2' align='center'>                                                                                                                                          
<tr>                                                                                                                                                                                                       
  <td class="table1" align="center" colspan="10"><font style="font-size: 16px"><b> Supplier Available </b></font></td>                                                                                      
</tr>                                                                                                                                                                                                      
<tr>                                                                                                                                                                                                       
  <td  class="table3" align='center' ><B>&nbsp;</td>                                                                                                                                                       
  {*<td  class="table3" align='center' ><B>&nbsp;</td>*}                                                                                                                                                    
  <td  class="table3" align='center' ><B>Sr.No</td>                                                                                                                                                       
	<td  class="table3" align='center' ><B>Company Name</td>                                                                                                                                                   
	<td  class="table3" align='center' ><B>Contact Person1</td>                                                                                                                                                  
	<td  class="table3" align='center' ><B>Contact Person2</td>                                                                                                                                                    
	<td  class="table3" align='center' ><B>Landline No</td>                                                                                                                                                    
	<td  class="table3" align='center' ><B>Mobile</td>                                                                                                                                                    
	<td  class="table3" align='center' ><B>City</td>                                                                                                                                                         
	<td  class="table3" align='center' ><B>Email</td>                                                                                                                                                        
	<td  class="table3" align='center' ><B>Web</td>                                                                                                                                                          
</tr>                                                                                                                                                                                                      
 {section name="sec1" loop=$partyItemDetailArray}                                                                                                                                                          
<tr>                                                                                                                                                                                                       
  <td class="table3" align="center">                                                                                                                                                                       
    <a href="supplier.php?supplierId={$partyItemDetailArray[sec1].supplierId}" class="link"><img src="./images/b_edit.png" border="0" width="15" height="15"></a>                                                     
  </td>                                                                                                                                                                                                 
  {*<td class="table3" align="center">                                                                                                                                                                                                       
  	<a href="supplierDelete.php?supplierId={$partyItemDetailArray[sec1].supplierId}" class="link" onclick="return confirm('Are You Sure?');"><img src="./images/deleteIcon.png" border="0" width="15" height="15"></a>
  </td>*}
   <td class="table3" align="center">{$smarty.section.sec1.rownum}</td>                                                                                                                                                                                                    
  <td class="table3" align="left" id="tooltip">{$partyItemDetailArray[sec1].companyName}
  	<span>Address :{$partyItemDetailArray[sec1].address}</span>
  </td>                                                                                                                            
  <td class="table3" align="left" id="tooltip">{$partyItemDetailArray[sec1].contactPerson1}
  	<span>mobile1 :{$partyItemDetailArray[sec1].mobile1}</span>
  </td>                                                                                                                           
  <td class="table3" align="left" id="tooltip">{$partyItemDetailArray[sec1].contactPerson2}
  	<span>mobile2 :{$partyItemDetailArray[sec1].mobile2}</span>
  </td>                                                                                                                             
  <td class="table3" align="right">{$partyItemDetailArray[sec1].phoneNo}</td>                                                                                                                             
  <td class="table3" align="right">{$partyItemDetailArray[sec1].mobile1}</td>                                                                                                                             
  <td class="table3" align="left">{$partyItemDetailArray[sec1].city}</td>                                                                                                                                 
  <td class="table3" align="left">{$partyItemDetailArray[sec1].email}</td>                                                                                                                                
  <td class="table3" align="left">{$partyItemDetailArray[sec1].web}</td>                                                                                                                                  
</tr>                                                                                                                                                                                                      
{/section}                                                                                                                                                                                                 
</table>                                                                                                                                                                                                   
</form>                                                                                                                                                                                                    
{include file="footer.tpl"}